import { Controller, Get, Post, Body, BadRequestException } from '@nestjs/common';
import { PhotosTypeService } from './photosType.service';
import { CreatePhotosTypeDto } from './dto/create-photosType.dto';
import { ApiBearerAuth, ApiOperation, ApiTags } from '@nestjs/swagger';
@ApiTags('photosType')
@ApiBearerAuth()
@Controller()
export class PhotoTypeController {
    constructor(private readonly photoTypeService: PhotosTypeService) {}

    @ApiOperation({ summary: '创建照片类型' })
    @Post('/photoType/create')
    async create(@Body() input: CreatePhotosTypeDto) {
        try {
            return await this.photoTypeService.create(input);
        } catch (e) {
            throw new BadRequestException('创建失败', e?.message);
        }
    }

    @ApiOperation({ summary: '获取所有照片类型' })
    @Get('/photoType/findAll')
    findAll() {
        return this.photoTypeService.findAll();
    }
}
